package com.smartleanx.module.hrm.controller.admin.employee.login;

import com.smartleanx.framework.common.validation.Mobile;
import com.smartleanx.framework.common.validation.ValidatedGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;

/**
 * 创建员工登录信息 Request VO
 *
 * @author tengcj
 * @since 2024/7/1
 */
@Data
public class EmployeeLoginInfoSaveReqVO {

    @Schema(description = "用户编号", example = "1")
    @Null(message = "id必须为空", groups = {ValidatedGroup.CreateGroup.class})
    @NotNull(message = "id不能为空", groups = {ValidatedGroup.UpdateGroup.class})
    private Long id;

    @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "用户名不能为空", groups = {ValidatedGroup.CreateGroup.class})
    @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户名由 数字、字母 组成")
    @Size(min = 4, max = 30, message = "用户名长度为 4-30 个字符")
    private String username;

    @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
    @NotBlank(message = "用户昵称不能为空")
    @Size(max = 30, message = "用户昵称长度不能超过30个字符")
    private String nickname;

    @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "密码不能为空", groups = {ValidatedGroup.CreateGroup.class})
    @Length(min = 4, max = 16, message = "密码长度为 4-16 位")
    private String password;

    @Schema(description = "员工编号")
    private Long employeeId;

    @Schema(description = "部门ID", example = "1")
    private Long deptId;

    @Schema(description = "岗位ID", example = "1")
    private Long postId;

    @Schema(description = "手机号码", requiredMode = Schema.RequiredMode.REQUIRED)
    // @NotBlank(message = "手机号码不能为空")
    @Mobile
    private String mobile;

    @Schema(description = "邮箱")
    @Size(max = 50, message = "邮箱长度不能超过 50 个字符")
    @Email(message = "邮箱格式不正确")
    private String personalEmail;

    @Schema(description = "性别")
    private Integer sex;

    @Schema(description = "备注", example = "我是一个用户")
    private String remark;

    @Schema(description = "角色编号列表")
    private Collection<Long> roleId ;

    private Integer isLeader;
}
